﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace UCNKompetenceBors.Admin
{
    public partial class adminExchange : System.Web.UI.Page
    {
        private PagedDataSource _pagedDataSource = new PagedDataSource();

        private int _itemsPerPage = 5;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindSubMenu();

                #region Globalization
                string culture = String.Empty;

                if (HttpContext.Current.Session["MyCulture"] != null)
                    culture = HttpContext.Current.Session["MyCulture"].ToString();

                if (!String.IsNullOrEmpty(culture))
                    GeneralTools.SetCulture(culture);
                LocalizeControls();
                #endregion
            }
        }

        /// <summary>
        /// Binds the sub menu links.
        /// </summary>
        private void BindSubMenu()
        {
            hyLinkAdminDashboard.NavigateUrl = "~/Admin/admin.aspx";
            hyLinkUserHandling.NavigateUrl = "~/Admin/adminUsers.aspx";
            hyLinkNewsHandling.NavigateUrl = "~/Admin/adminNews.aspx";
            hyLinkAdminExchange.NavigateUrl = "~/Admin/adminExchange.aspx";
            hyLinkAdminSale.NavigateUrl = "~/Admin/adminExchangeSale.aspx";
            hyLinkAdminPurchase.NavigateUrl = "~/Admin/adminExchangePurchase.aspx";
            hyLinkAdminCategory.NavigateUrl = "~/Admin/adminExchangeCategory.aspx";
            hyLinkEditInformation.NavigateUrl = "~/Admin/adminInformation.aspx";
            hyLinkContactPerson.NavigateUrl = "~/Admin/adminContactPerson.aspx";
            hyLinkResetUsers.NavigateUrl = "~/Admin/adminUsersReset.aspx";
            hylinkDepartment.NavigateUrl = "~/Admin/adminDepartment.aspx";
        }

        /// <summary>
        /// Localizes the controls of the site, based on the current UI Culture.
        /// </summary>
        private void LocalizeControls()
        {
            hyLinkAdminDashboard.Text = GetLocalResourceObject("hyLinkAdminDashboardText").ToString();
            hyLinkUserHandling.Text = GetLocalResourceObject("hyLinkUserHandlingText").ToString();
            hyLinkAdminExchange.Text = GetLocalResourceObject("hyLinkAdminExchangeText").ToString();
            hyLinkNewsHandling.Text = GetLocalResourceObject("hyLinkNewsHandlingText").ToString();
            hyLinkEditInformation.Text = GetLocalResourceObject("hyLinkEditInformationText").ToString();
            hyLinkResetUsers.Text = GetLocalResourceObject("hyLinkResetUsersText").ToString();
            hyLinkContactPerson.Text = GetLocalResourceObject("hyLinkContactPersonText").ToString();
            hylinkDepartment.Text = GetLocalResourceObject("hylinkDepartmentText").ToString();

            hyLinkAdminPurchase.Text = GetLocalResourceObject("hyLinkAdminPurchaseText").ToString();
            hyLinkAdminSale.Text = GetLocalResourceObject("hyLinkAdminSaleText").ToString();
            hyLinkAdminCategory.Text = GetLocalResourceObject("hyLinkAdminCategoryText").ToString();

            lblAdminExchangeMessage.Text = GetLocalResourceObject("lblAdminExchangeMessageText").ToString();
            lblAdminContentHeader.Text = GetLocalResourceObject("lblAdminContentHeaderText").ToString();
        }
    }
}